package com.technical.services;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import com.dao.AutomaticInterventionDAO;
import com.dao.impl.AutomaticInterventionDAOImpl;
import com.rev.Automaticintervention;
import com.technical.referentials.AutomaticInterventionReferentialPath;

@Path(AutomaticInterventionReferentialPath.INTERVENTION_PATH)
public class AutomaticInterventionServices {
	@Context
	UriInfo uriInf;
	
	private AutomaticInterventionDAO aiDAO;
	
	public AutomaticInterventionServices() {
		aiDAO = new AutomaticInterventionDAOImpl();
	}
	
	@GET
	@Path(AutomaticInterventionReferentialPath.INTERVENTION_RESOURCE_PATH + AutomaticInterventionReferentialPath.INTERVENTION_RESOURCE_ID_PATH + "/{id}")
	@Produces(MediaType.APPLICATION_JSON)
	public Automaticintervention getById(@PathParam("id") String id){
		return aiDAO.findById(Integer.parseInt(id));
	}
	
	@POST
	@Path(AutomaticInterventionReferentialPath.INTERVENTION_RESOURCE_PATH)
	@Consumes(MediaType.APPLICATION_JSON)
	public Response insertIntervention(Automaticintervention intervention){
		aiDAO.insert(intervention);
		return null;
	}

	@GET
	@Path("")
	@Produces(MediaType.APPLICATION_JSON)
	public Automaticintervention getMessageById(@PathParam("messageId") String messageId){
		return null;
	}
	
	@GET
	@Path("")
	@Produces(MediaType.APPLICATION_JSON)
	public Automaticintervention getByActionId(@PathParam("actionId") String actionId){
		return null;
	}
	
}
